<{include file='../common/head.tpl'}>
<div class="main w1060">
	<div class="twomain">
		<div class="biaoge">  
                    <h2 class="btzong2">报备列表 Network Records<{if $level==4}>
                    <span style="float:right;"><a href="/report/add">添加报备</a>&nbsp;&nbsp;&nbsp;&nbsp;</span><{/if}></h2>
		<form name="form1" id="myform" method="post" action="/report/SetStatus" >	
                    <table width="100%" border="0" cellspacing="0">
			  <tr>
                              <{if $level!=4}><td bgcolor="#f5f5f5"><strong>全选</strong></td><{/if}>
                              <td bgcolor="#f5f5f5">序号</td>
                              <td bgcolor="#f5f5f5"><strong>网点名称</strong></td>
                              <td bgcolor="#f5f5f5"><strong>项目</strong></td>
                              <td bgcolor="#f5f5f5"><strong>报备内容</strong></td>
				<td bgcolor="#f5f5f5"><strong>报备起始时间</strong></td>
				<td bgcolor="#f5f5f5"><strong>报备截止时间</strong></td>
				<td bgcolor="#f5f5f5"><strong>报备状态</strong></td>
                                <td bgcolor="#f5f5f5"><strong>操作</strong></td>
			  </tr>
                          <{if $list}>
                          <{foreach $list as $key => $val}>
			  <tr id="nr_<{$val.nr_id}>">
                              <{if $level!=4}><td><input type="checkbox" name="nr_id[]" value="<{$val.nr_id}>" /></td><{/if}>
                              <td><{$val.nr_order}></td>
                              <td><{$network_names[$val.network_id]}></td>
                              <td>
                                  <{$val['project'].project_name}>
                              </td>
				<td><{$val.content}></td>
                                <td><{$val.start_time|date_format:"%Y-%m-%d"}></td>
				<td><{$val.end_time|date_format:"%Y-%m-%d"}></td>
                                <td><{$audit[$val.audit]}><{$status[$val.status]}></td>
                                <td>
                                    <{if $network_id==$val.network_id&&$val.status==-1}>
                                    <a href="/report/add?nr_id=<{$val.nr_id}>">编辑</a> | <a href="javascript:;" onclick="del(<{$val.nr_id}>);">删除</a>
                                    <{else}>
                                    <a href="javascript:;" onclick="history('<{$val.nr_id}>');">历史</a>
                                    <{/if}>
                                </td>
			  </tr>
                          <{/foreach}>
                            <{if $level!=4}>
                            <tr>
                                <td colspan="8">
                                    <input type="checkbox" id="che_box" value="" />全选&nbsp;&nbsp;&nbsp;
                                    <input type="radio" name="status" value="1" checked="checked"/>通过<input type="radio" name="status" value="2" />不通过
                                    <input type="submit" value="提交" /><{$page}></td>
                              </tr>
                            <{/if}>
                          <{/if}>
		  </table>
                </form>
		</div>
	</div>
</div>
<script type="text/javascript">
 function showRequest(formData, jqForm, options) { 
    return true;
}
function showResponse(responseText, statusText, xhr, $form)  { 
    alert(responseText.note);
    window.location.reload();
}
 $(function(){
    //复选框事件  
    //全选、取消全选的事件  
    $(document).on("click","#che_box",function(){
        var ischecked= $("#che_box:checked").length;

        var $checkboxs =$("input[name='nr_id[]']");
        if(ischecked){
            $checkboxs.prop("checked",true);
        }else{
            $checkboxs.prop("checked",false);
        }
    }); 
    var options = {         
        beforeSubmit:  showRequest,  
        success:       showResponse,
        dataType:  'json'
    }
    $('#myform').ajaxForm(options); 
})
//详细审核历史记录
function history(nr_id){
    $.layer({
        type: 2, 
        title: '网点报备审核历史记录',
        border:[10, 0.3, '#000'],
        closeBtn:[0, true],
        shade: [0.5, '#000'],
        offset: ['100px', ''],
        area: ['500px', '250px'],
        iframe: {src: '/report/History?nr_id='+nr_id}
    });
}
//删除
function del(nr_id){
    if (confirm('确定删除？')) {
        $.getJSON('/report/del',{nr_id:nr_id},function(res){
            if (res.status==1) {
                $('#nr_'+nr_id).remove();
            }
            alert(res.note);
        });
    }

}
</script>
<!--main End-->
<{include file="../common/footer.tpl"}>